Method for line and word segmentation for handwritten text images

ABSTRACT

A method for segmenting an image containing handwritten text into line segments and word segments. The image is horizontally down sampled at a first ratio. Connected regions in the down-sampled image are detected; horizontal neighboring ones are merged to form lines, to segment the original image into line images. Each line image is horizontally down sampled at a second ratio which is smaller than the first ratio. Connected regions in the down-sampled line image are detected to obtain potential word segmentation positions. A path is a way of dividing the line at some or all of the potential word segmentation positions into multiple path segments; for each of all possible paths, word recognition is applied to each path segment to calculate a word recognition score, and an average word recognition score for the path is calculated; the path with the highest score gives the final word segmentation.

BACKGROUND OF THE INVENTION Field of the Invention

This invention relates to a method for handwritten text recognition, andin particular, to a method of segmenting lines and words from ahandwritten text image.

Description of Related Art

Handwriting recognition plays an important role in the field ofartificial intelligence. It represents the ability of a computer toreceive and interpret intelligible handwritten input from sources suchas paper documents, photographs, touch-screens and other devices.Processing an image containing text may involve, for example, extractinga text region from the image, extracting lines of text from the region(line segmentation), then extracting words of text from the lines (wordsegmentation), before applying text recognition.

For handwritten text, line and word segmentation often present achallenge because there are many variances in the handwriting. Somemethods have been proposed for this task. For example, U.S. Pat. Appl.Pub. No. 2007/0041642, entitled “Post-OCR image segmentation intospatially separated text zones”, describes “a post-recognition procedureto group text recognized by an Optical Character Reader (OCR) from adocument image into zones. Once the recognized text and thecorresponding word bounding boxes for each word of the text arereceived, the procedure described dilates (expands) these word boundingboxes by a factor and records those which cross. Two word bounding boxeswill cross upon dilation if the corresponding words are very close toeach other on the original document. The text is then grouped into zonesusing the rule that two words will belong to the same zone if their wordbounding boxes cross upon dilation. The text zones thus identified aresorted and returned.” (Abstract.)

U.S. Pat. No. 5,933,525, entitled “Language-independent andsegmentation-free optical character recognition system and method”,describes “a language-independent and segment free OCR system and method[which] comprises a unique feature extraction approach which representstwo dimensional data relating to OCR as one independent variable(specifically the position within a line of text in the direction of theline) so that the same CSR technology based on HMMs can be adapted in astraightforward manner to recognize optical characters. After a linefinding stage, followed by a simple feature-extraction stage, the systemcan utilize a commercially available CSR system, with little or nomodification, to perform the recognition of text by and training of thesystem. The whole system, including the feature extraction, training,and recognition components, are designed to be independent of the scriptor language of the text being recognized. The language-dependent partsof the system are confined to the lexicon and training data.Furthermore, the method of recognition does not require pre-segmentationof the data at the character and/or word levels, neither for trainingnor for recognition. In addition, a language model can be used toenhance system performance as an integral part of the recognitionprocess and not as a post-process, as is commonly done with spellchecking, for example.” (Abstract.)

Chinese Patent Appl. Pub. No. CN 1005271560, entitled “Picture wordssegmentation method”, describes “a method for detecting text image,comprising the steps of: (1) The combined picture on each colorcomponent edge map obtained cumulative edge map; (2) the cumulative edgemap is set for an edge point in the picture of the respective colors,depending on the color point edge, with the clustering of the cumulativeedge map is divided into several sub-edge map sheets, each sub-edge mapcontains similar color edge points; (3) in each sub-edge map, multiplehorizontal and vertical projection, according to the regional projectionin the vertical direction and horizontal segmentation, positioning textin the image area. In the present invention, after obtaining originalcumulative edge map using the clustering method based on the color ofthe cumulative edge map is divided into several sub-edge map, edge mapof the sub edge is simplified, so that the detection area is relativelysimple text pictures and accurate.” (Abstract.)

SUMMARY

The present invention is directed to a line segmentation and wordsegmentation method for segmenting handwritten text.

An object of the present invention is to provide a method to segmenttext lines and words which balance the accuracy and the efficiency.

Additional features and advantages of the invention will be set forth inthe descriptions that follow and in part will be apparent from thedescription, or may be learned by practice of the invention. Theobjectives and other advantages of the invention will be realized andattained by the structure particularly pointed out in the writtendescription and claims thereof as well as the appended drawings.

To achieve these and/or other objects, as embodied and broadlydescribed, the present invention provides a method implemented on acomputer for segmenting an input image into line segments and wordsegments, the input image being a binary image containing text, themethod including: (a) horizontally down sampling the input image using afirst down-sampling ratio; (b) detecting connected regions in thedown-sampled image obtained in step (a); (c) identifying horizontallyneighboring connected regions that belong to same lines to form linelists containing such horizontally neighboring connected regions; (d)segmenting the input image into a plurality of line segments, each linesegment being a region of the input image that corresponds to a boundingbox in the down-sampled image containing all connected regions in acorresponding line lists obtained in step (c); and for each of the linesegments obtained in step (d): (e) horizontally down sampling the linesegment using a second down-sampling ratio; (f) detecting connectedregions in the down-sampled line segment obtained in step (e); and (g)segmenting the line segment obtained from step (d) into word segmentsusing the connected regions obtained in step (f), wherein the seconddown-sampling ratio is smaller than the first down-sampling ratio.

In another aspect, the present invention provides a computer programproduct comprising a computer usable non-transitory medium (e.g. memoryor storage device) having a computer readable program code embeddedtherein for controlling a data processing system, the data processingsystem comprising a computer and one or more printers, the computerreadable program code configured to cause the computer in the dataprocessing system to execute the above method.

It is to be understood that both the foregoing general description andthe following detailed description are exemplary and explanatory and areintended to provide further explanation of the invention as claimed.

BRIEF DESCRIPTION OF THE DRAWINGS

FIGS. 1 and 2 are flow charts that schematically illustrate ahandwritten text segmentation method including line segmentation andword segmentation according to embodiments of the present invention.

FIG. 3 schematically illustrates horizontal down sampling of anexemplary text image in the embodiment of the present invention.

FIG. 4 schematically illustrates an exemplary line segmentation of thetext image of FIG. 3.

FIG. 5 schematically illustrates an exemplary horizontal down samplingof the text image of FIG. 3.

FIGS. 6(a) and 6(b) schematically illustrate examples of paths used inword segmentation according to an embodiments of the present invention.

FIG. 7 is a block diagram of a computer system in which embodiments ofthe present invention may be implemented.

DETAILED DESCRIPTION OF PREFERRED EMBODIMENTS

The handwritten text segmentation method according embodiments of thepresent invention performs line segmentation first to segment the inputtext image into lines, and then word segmentation to segment each lineinto words. To perform line segmentation, the input image isdown-sampled in the horizontal direction using a first down-samplingratio, so that the texts in the same line of the down-sampled image willtend to cling to each other, as shown in the example of FIG. 3.Connected regions in the down-sampled image are detected, and are usedto detect lines and to segment lines in the original image. Then, eachsegmented line of the original input image is down-sampled in thehorizontal direction using a second down-sampling ratio, which issmaller than the first down-sampling ratio and may be different fordifferent lines, so that the text characters from each single word inthe down-sampled line image will tend to cling to each other. Connectedregions in the down-sampled line segment are detected, and are used todetect words and segment the line segment into word segments.

A handwritten text segmentation method according to embodiments of thepresent invention is described in more detail with reference to the flowchart of FIGS. 1 and 2. The step of obtaining an input image (step S101)may include binarizing the original image if it is a color or grayscaleimage. In the description below, the input image is a binary image. Theinput image is a pure text image, meaning that it contains text but doesnot contain other objects such as pictures or graphics and that the textis not dispersed in tables or flowcharts or other kinds of charts. Inthe descriptions below, it is assumed that text lines run in thehorizontal or near horizontal direction. Those skilled in the art willappreciate that the method can be easily modified to handle text linesthat run in the vertical or near vertical direction.

First, a first down-sampling ratio N is calculated (step S102) and theinput image is down-sampled in the horizontal direction using the firstdown-sampling ratio (step S103). In other words, every N-th verticalcolumn of pixels in the input image is taken to form the horizontallydown-sampled image. The first down-sampling ratio N is calculated (stepS102) as follows.

The connected regions in the input image are detected. In a binaryimage, a connected region (sometimes also referred to as connectedcomponent) is a group of foreground pixels (e.g. black pixels for ablack-text-on-white-background image) that are connected to each other.Any suitable method may be used to detect the connected regions. Thehorizontal distance between each pair of horizontally adjacent connectedregions is determined. An average value of all such distances iscalculated, and the first down-sampling ratio N is set based on thecalculated average distance. In a preferred embodiment, the firstdown-sampling ratio N is equal to three times the average distance.

In the above calculation, two connected regions are deemed to behorizontally adjacent if their vertical positions are different fromeach other by no more than a predetermined threshold and they are notseparated by other connected regions. The distance between twohorizontally adjacent connected regions may be defined as the distancebetween the two respective bounding boxes of the two connected regions.A bounding box of a connected region is the smallest rectangular boxthat completely contains the connected region.

Preferably, in step S103, the input image is down-sampled onlyhorizontally, but down-sampling vertically may be performed in additionto horizontal down-sampling if the down-sampling ratio for the verticaldirection is much smaller than that for the horizontal direction.

After horizontal down-sampling (step S103), all connected regions in thehorizontally down-sampled image are detected (step S104), and theircorresponding bounding boxes are generated and stored into a set (setA).

The detected connected regions are horizontally merged together (stepS105). Horizontal merging is performed by identifying horizontallyneighboring connected regions that belong to the same line to form listsof such horizontal neighbors.

More specifically, for a given connected region, if another connectedregion (1) has a vertical position that is offset from that of the givenconnected region by an amount smaller than a predetermined threshold,and (2) among all of the connected regions that meet criterion (1), islocated closest to the given connected region to its left or right, thenthe other connected region is deemed to be a horizontal neighbor locatedon the same line as the given connected region. To perform the mergingstep, a search is conducted, starting from a connected region C, whichmay be one randomly selected from set A, to find its horizontalneighbors that meet the above-described criteria (there may be zero, oneor two such neighbors). The horizontal neighbors so found are added to aline list that contains the connected region C. The search is conductedagain using each of the already found horizontal neighbors as thecurrent connected region to find additional connected regions on thesame line. The search continues until no connected regions meeting theabove criteria can be found. The already found connected regions areremoved form set A. Such a search is similar in concept to abreath-first search algorithm for searching a graph. As a result, oneline list is generated, which contains the connected region C and otherconnected regions found in the search. Then, another connected region israndomly selected from the remaining connected regions in set A, and theabove-described search is performed to generate another line list. Thiscontinues until set A is empty. As a result, a number of line lists aregenerated.

The input image is segmented into lines using the lines lists of thehorizontally merged connected regions (step S106). More specifically,for each line list, a bounding box is generated in the down-sampledimage that encloses all connected regions in that line list. Examples ofsuch bounding boxes in the down-sampled image are shown in FIG. 4, lefthand side. A corresponding bounding box is generated in the original(prior to down-sampling) image, which constitutes a line segment of theoriginal image. Examples of such bounding boxes in the original imageare shown in FIG. 4, right hand side. As a result, a plurality of linesegments are generated.

To perform word segmentation, each individual line segment (i.e. animage patch contained in one line bounding box) is horizontallydown-sampled using a second down-sampling ratio M, where i is an indexof the lines (steps S107-S109). More specifically, for each line segment(step S107), the second down-sampling ratio M_(i) is determined (stepS108), and the line image is down-sampled in the horizontal directionusing the second down-sampling ratio M, (step S109). In other words,every M_(r)th vertical column of pixels in the line segment is taken toform the horizontally down-sampled line segment. FIG. 5 illustrates anexample of down-sampling of a text line.

In one embodiment, the second down-sampling ratio Mi is determined instep S108 as follows. The connected regions in the line segment aredetected; horizontal distance between each pair of horizontally adjacentconnected regions is determined; an average value of all such distancesis calculated; and the second down-sampling ratio M_(i) is set based onthe calculated average distance. In a preferred embodiment, the seconddown-sampling ratio M, is equal to the average distance.

Preferably, in step S109, the line image is down-sampled onlyhorizontally, but down-sampling vertically may be performed in additionto horizontal down-sampling if the down-sampling ratio for the verticaldirection is much smaller than that for the horizontal direction.

A process S110 is then performed to segment each line into wordsegments. This process is described below with reference to FIG. 2.

First, connected regions in the down-sampled line segment are detected,and they are used to determine the potential word segmentation positionsin the original (prior to down-sampling) line segment (step S201). Thepotential word segmentation positions in the original line segment areset at positions corresponding to locations in the gaps betweenconnected regions in the down-sampled line segments, in other words, thetext content between the potential word segmentation positionscorrespond to the connected regions detected in the down-sampled linesegments.

Then, word segmentation is performed on the original line segment usinga path-score comparison approach, described in more detail below.

A path is a way of dividing the line segment at all or some of thepotential word segmentation positions, to divide the line into multiplesegments (referred to as “path segments” for convenience). For example,in the example shown in FIG. 6(a), the text line segment has ninepotential word segmentation positions; each example in FIG. 6(b)schematically depicts a path. In the exemplary Path(1), the line segmentis divided at all nine potential word segmentation positions; in theexemplary Path(n), the line segment is divided at all but the first oneof the potential word segmentation positions (so the first and secondconnected regions become one path segment); in the exemplary Path(m),the line segment is divided at all but the fifth one of the potentialword segmentation positions (so the fifth and sixth connected regionsbecome one path segment); etc.

A path may also be viewed as a way of merging some or all of theadjacent connected regions. Thus, exemplary Path(1) is a path where eachconnected regions is a path segment (no merging); exemplary Path(n) is apath where the first and second connected regions are merged to becomeone path segment; exemplary Path(m) is a path where the fifth and sixthconnected regions are merged to become one path segment; etc.

In a broader sense, a “path” of an image consists of a series of imagesegments covering every pixel of an image, where each segment comprisesa number of different and non-overlapping pixels in the input image.

The path-score comparison evaluates all possible paths that can beformed for the line based on the potential word segmentation positions.For each path (step S202 and step S206), word recognition is applied toeach path segment to calculate a word recognition score (step S203), andthe scores for all path segments are averaged to calculate an averageword recognition score for the path (step S204). Word recognition is aprocess that compares an image patch to a collection of samples todetermine a score representing how likely the image segment is a word.Any suitable word recognition algorithm may be used for this step. Theaverage word recognition scores are calculated for all possible paths(step S205). Among all possible paths, the path having the highestaverage word recognition score is determined to be the final wordsegmentation for the line (step S207), and the line image is segmentedinto word images accordingly (step S208).

For example, in the examples of FIG. 6(b), Path(n) will have a lowerscore than Path(1) and Path(m) will have a lower score than Path(m)because the path segment “that many” is not a word, nor is “nvolve”.Path(m) will likely be the one with the highest score among all possiblepaths.

The purpose of using the path scoring method is to find an optimal pathbased on which words in the input image can be recognized with the mostaccuracy, thereby enhancing the accuracy of handwriting recognition.

Referring back to FIG. 1, steps S107 to S110 are repeated for each linesegment (step S111).

FIG. 7 is a block diagram of an exemplary computer in which embodimentsof the present invention may be implemented. As shown in FIG. 1, thiscomputer 10 comprises a Central Processing Unit (CPU) 101, a memory 102,an input unit 103 such as a keyboard or a tablet stylus pen, a displayunit 104 such as a computer monitor or touchscreen display, and anetwork interface 105, all these components (including those not shown)communicating with each other internally via a bus 106. Through thenetwork interface 105, the computer 10 is connected to a network 20,such as a LAN or WAN, and communicate with other devices connected tothe network.

Usually the memory 102 stores computer-executable instructions orsoftware programs accessible to the CPU 101, which is configured toexecute these software programs as needed in operation. Preferably, suchsoftware programs are designed to run on Windows OS, Macintosh OS, orUnix X Windows or other popular computer operating systems implementinga GUI (graphic user interface), such as a touchscreen and/or a mouse anda keyboard, coupled with a display monitor. In one embodiment, suchsoftware in the memory 102 includes a program 108, which, when executedby the CPU 101, performs the line and word segmentation method describedabove. In addition to the recognizing program 108, the CPU 101 is alsoconfigured to execute other types of software (e.g., administrativesoftware), applications (e.g., network communication application),operating systems, etc.

It will be apparent to those skilled in the art that variousmodification and variations can be made in the above-described line andword segmentation method for processing handwritten text images andrelated apparatus and system of the present invention without departingfrom the spirit or scope of the invention. Thus, it is intended that thepresent invention cover modifications and variations that come withinthe scope of the appended claims and their equivalents.

1. A method implemented on a computer for segmenting an input image intoline segments and word segments, the input image being a binary imagecontaining text, the method comprising: (a) down sampling the inputimage along a first direction using a first down-sampling ratio; (b)detecting connected regions in the down-sampled image obtained in step(a); (c) identifying neighboring connected regions that are neighbors ofeach other along the first direction that belong to same lines to formline lists containing such neighboring connected regions; (d) segmentingthe input image into a plurality of line segments of the input image,each line segment of the input image being a region of the input imagethat corresponds to a bounding box in the down-sampled image containingall connected regions in a corresponding line list obtained in step (c);and for each of the line segments of the input image obtained in step(d), (e) down sampling the line segment of the input image along thefirst direction using a second down-sampling ratio; (f) detectingconnected regions in the down-sampled line segment obtained in step (e);and (g) segmenting the line segment of the input image obtained fromstep (d) into word segments at one or more word segmentation positionsusing the connected regions obtained in step (f), wherein the wordsegmentation positions are a subset of positions corresponding tolocations in gaps between the connected regions in the down-sampled linesegment of step (e) that have been detected in step (f)
 2. The method ofclaim 1, wherein the first down-sampling ratio is calculated from theinput image, and the second down-sampling ratio for each line segment iscalculated from the line segment.
 3. The method of claim 2, furthercomprising, before step (a), calculating the first down-sampling ratio,which comprises: (h1) detecting connected regions in the input image;(h2) calculating a distance along the first direction between each pairof adjacent connected regions detected in step (h1) that are adjacent toeach other along the first direction; (h3) calculating a first averagedistance which is an average of all distances calculated in step (h2);and (h4) setting the first down-sampling ratio based on the firstaverage distance calculated in step (h3).
 4. The method of claim 3,wherein in step (h4), the first down-sampling ratio is equal to threetimes the first average distance.
 5. The method of claim 4, furthercomprising, before step (e), calculating the second down-sampling ratio,which comprises: (i1) detecting connected regions in the line segmentobtained in step (d); (i2) calculating a distance along the firstdirection between each pair of adjacent connected regions obtained instep (i1) that are adjacent to each other along the first direction;(i3) calculating a second average distance which is an average of alldistances calculated in step (i2); and (i4) setting the seconddown-sampling ratio based on the second average distance calculated instep (i3).
 6. The method of claim 5, wherein in step (i4), the seconddown-sampling ratio is equal to the second average distance.
 7. Themethod of claim 1, wherein step (c) comprises: (c1) putting allconnected regions detected in step (b) in a set; (c2) selecting one ofthe connected regions from the set; (c3) searching for first-directionneighbors of the selected connected region, a first-direction neighborbeing a connected region that (1) has a position along a seconddirection non-parallel to the first direction that is offset from thatof the selected connected region by an amount smaller than apredetermined threshold, and (2) among all of the connected regions thatmeet criterion (1), is located closest along the first direction to theselected connected region; (c4) adding any first-direction neighborsfound in the search of step (c3) to a line list that contains theselected connected region, and removing the first-direction neighborsfrom the set; (c5) for the first-direction neighbors found in step (c3),repeating the searching step (c3) and the adding and removing step (c4),until no first-direction neighbors are found in a search, whereby a linelist is generated; and (c6) selecting another connected region from theset, and repeating steps (c3), (c4) and (c5) to generate another linelist, until the set is empty, whereby a plurality of line lists aregenerated.
 8. The method of claim 1, wherein step (g) comprises: basedon the connected region detected in step (f), determining a plurality ofpotential word segmentation positions for the line segment, eachpotential word segmentation positions corresponding to a location in agap between connected regions in the down-sampled line segment; definingall possible paths for the line segment, each path being a division ofthe line segment at all or some of the potential word segmentationpositions that divide the line segment into a plurality of pathsegments; for each path, applying word recognition to each path segmentto calculate a word recognition score for the path segment, andaveraging word recognition scores for all the path segments to calculatean average word recognition score for the path; determining a path amongall the possible paths for the line segment that has a highest averageword recognition score; and segmenting the line segment into wordsegments according to the determined path.
 9. A computer program productcomprising a computer usable non-transitory medium having a computerreadable program code embedded therein for controlling a data processingapparatus, the computer readable program code configured to cause thedata processing apparatus to execute a process for segmenting an inputimage into line segments and word segments, the input image being abinary image containing text, the process comprising: (a) down samplingthe input image along a first direction using a first down-samplingratio; (b) detecting connected regions in the down-sampled imageobtained in step (a); (c) identifying neighboring connected regions thatare neighbors of each other along the first direction that belong tosame lines to form line lists containing such neighboring connectedregions; (d) segmenting the input image into a plurality of linesegments of the input image, each line segment of the input image beinga region of the input image that corresponds to a bounding box in thedown-sampled image containing all connected regions in a correspondingline list obtained in step (c); and for each of the line segments of theinput image obtained in step (d), (e) down sampling the line segment ofthe input image along the first direction using a second down-samplingratio; (f) detecting connected regions in the down-sampled line segmentobtained in step (e); and (g) segmenting the line segment of the inputimage obtained from step (d) into word segments at one or more wordsegmentation positions using the connected regions obtained in step (f),wherein the word segmentation positions are a subset of positionscorresponding to locations in gaps between the connected regions in thedown-sampled line segment of step (e) that have been detected in step(f)
 10. The computer program product of claim 9, wherein the firstdown-sampling ratio is calculated from the input image, and the seconddown-sampling ratio for each line segment is calculated from the linesegment.
 11. The computer program product of claim 10, wherein theprocess further comprises, before step (a), calculating the firstdown-sampling ratio, which comprises: (h1) detecting connected regionsin the input image; (h2) calculating a distance along the firstdirection between each pair of adjacent connected regions detected instep (h1) that are adjacent to each other along the first direction;(h3) calculating a first average distance which is an average of alldistances calculated in step (h2); and (h4) setting the firstdown-sampling ratio based on the first average distance calculated instep (h3).
 12. The computer program product of claim 11, wherein in step(h4), the first down-sampling ratio is equal to three times the firstaverage distance.
 13. The computer program product of claim 12, whereinthe process further comprises, before step (e), calculating the seconddown-sampling ratio, which comprises: (i1) detecting connected regionsin the line segment obtained in step (d); (i2) calculating a distancealong the first direction between each pair of adjacent connectedregions obtained in step (i1) that are adjacent to each other along thefirst direction; (i3) calculating a second average distance which is anaverage of all distances calculated in step (i2); and (i4) setting thesecond down-sampling ratio based on the second average distancecalculated in step (i3).
 14. The computer program product of claim 13,wherein in step (i4), the second down-sampling ratio is equal to thesecond average distance.
 15. The computer program product of claim 9,wherein step (c) comprises: (c1) putting all connected regions detectedin step (b) in a set; (c2) selecting one of the connected regions fromthe set; (c3) searching for first-direction neighbors of the selectedconnected region, a first-direction neighbor being a connected regionthat (1) has a position along a second direction non-parallel to thefirst direction that is offset from that of the selected connectedregion by an amount smaller than a predetermined threshold, and (2)among all of the connected regions that meet criterion (1), is locatedclosest along the first direction to the selected connected region; (c4)adding any first-direction neighbors found in the search of step (c3) toa line list that contains the selected connected region, and removingthe horizontal first-direction neighbors from the set; (c5) for thefirst-direction neighbors found in step (c3), repeating the searchingstep (c3) and the adding and removing step (c4), until nofirst-direction neighbors are found in a search, whereby a line list isgenerated; and (c6) selecting another connected region from the set, andrepeating steps (c3), (c4) and (c5) to generate another line list, untilthe set is empty, whereby a plurality of line lists are generated. 16.The computer program product of claim 9, wherein step (g) comprises:based on the connected region detected in step (f), determining aplurality of potential word segmentation positions for the line segment,each potential word segmentation positions corresponding to a locationin a gap between connected regions in the down-sampled line segment;defining all possible paths for the line segment, each path being adivision of the line segment at all or some of the potential wordsegmentation positions that divide the line segment into a plurality ofpath segments; for each path, applying word recognition to each pathsegment to calculate a word recognition score for the path segment, andaveraging word recognition scores for all the path segments to calculatean average word recognition score for the path; determining a path amongall the possible paths for the line segment that has a highest averageword recognition score; and segmenting the line segment into wordsegments according to the determined path.
 17. The method of claim 1,wherein the second down-sampling ratio is smaller than the firstdown-sampling ratio.
 18. The method of claim 1, wherein the firstdirection is a horizontal direction.
 19. The computer program product ofclaim 9, wherein the second down-sampling ratio is smaller than thefirst down-sampling ratio.
 20. The computer program product of claim 9,wherein the first direction is a horizontal direction.